package itsm.isperp.module.service.sparepart;

import itsm.isperp.framework.data.commons.repository.BaseRepository;
import itsm.isperp.framework.data.domain.PageResponse;
import itsm.isperp.framework.service.BaseService;
import itsm.isperp.framework.web.request.JqGridFilterRuleOp;
import itsm.isperp.framework.web.request.JqGridRequest;
import itsm.isperp.module.entity.sparepart.SptSparepartDiscard;
import itsm.isperp.module.repository.sparepart.SptSparepartDiscardMapper;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SptSparepartDiscardService extends
		BaseService<SptSparepartDiscard> {

	@Autowired
	protected SptSparepartDiscardMapper sptSparepartDiscardMapper;

	@Override
	public BaseRepository<SptSparepartDiscard> getRepository() {
		return this.sptSparepartDiscardMapper;
	}

	public PageResponse<Map<String, Object>> findAllSptDetailByRequest(
			String sparepartId, JqGridRequest req) {

		req.addFilterRule("spt_sparepart_id", JqGridFilterRuleOp.eq,
				sparepartId);
		return sptSparepartDiscardMapper.findAllSptDetailByRequest(req)
				.toPage();
	}

}
